<template>
  <el-card>
    <el-form :inline="true">
      <el-form-item label="一级菜单">
        <el-select v-model="categoryStore.c1Id" @change="handler" :disabled="scene == 0 ? false : true">
          <el-option v-for="(c1, index) in categoryStore.c1Arr" :key="c1.id" :label="c1.name" :value="c1.id">
          </el-option>
        </el-select>

      </el-form-item>
      <el-form-item label="二级菜单">
        <el-select v-model="categoryStore.c2Id" @change="handler2" :disabled="scene == 0 ? false : true">
          <el-option v-for="(c2, index) in categoryStore.c2Arr" :key="c2.id" :label="c2.name" :value="c2.id">
          </el-option>
        </el-select>

      </el-form-item>
      <el-form-item label="三级菜单">
        <el-select v-model="categoryStore.c3Id" @change="" :disabled="scene == 0 ? false : true">
          <el-option v-for="(c3, index) in categoryStore.c3Arr" :key="c3.id" :label="c3.name" :value="c3.id">
          </el-option>
        </el-select> 
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script setup lang="ts">
import { reqC1, reqC2, reqC3 } from '@/api/product/attr';
import { onMounted, ref } from 'vue';
import { CategoryObj, AttrList } from '@/api/product/attr/type'
import useCategoryStore from '@/store/modules/category'
let categoryStore = useCategoryStore();
onMounted(() => {
  categoryStore.getC1();
})

const handler = () => {
  categoryStore.c2Id = "";
  categoryStore.c3Arr = [];
  categoryStore.c3Id = '';
  categoryStore.c3Arr = [];
  categoryStore.getC2();
}

const handler2 = () => {
  categoryStore.c3Id = '';
  categoryStore.c3Arr = [];
  categoryStore.getC3();

}

defineProps(["scene"]);

</script>

<style scoped></style>